﻿using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using WebApi.Core.IRepository;
using WebApi.Core.IService;
using WebApi.Core.Model;

namespace WebApi.Core.Service
{
    public class UserService : IUserService<UserEntity>
    {
        private readonly IUserRepository<UserEntity> _userRepository;
        private readonly ILogger<UserService> _logger;

        public UserService(IUserRepository<UserEntity> userRepository, ILogger<UserService> logger)
        {
            _userRepository = userRepository;
            _logger = logger;
        }

        public Task<bool> Add(UserEntity model)
        {
            throw new NotImplementedException();
        }

        public Task<bool> DeleteByIds(object[] ids)
        {
            throw new NotImplementedException();
        }

        public Task<UserEntity> QueryByID(int id)
        {
            var model = _userRepository.QueryByID(id);

            _logger.LogError("错误日志");

            //添加测试代码：
            int i = 4;
            int j = 0;
            var res = i / j;


            return model;
        }

        public Task<bool> Update(UserEntity model)
        {
            throw new NotImplementedException();
        }
    }
}
